package com.yanqu.road.server.cmd.activity.chuhan;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ChuHanProto;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.chuhan.CrossChuHanMgr;
import com.yanqu.road.server.manager.activity.chuhan.activity.CrossChuHanActivity;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_CHUHAN_CALL_SOLDIER, desc = "")
public class CrossChuHanCallSoldierCmd extends CrossUnionCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ChuHanProto.CrossChuHanRecruitSoldierReqMsg reqMsg = ChuHanProto.CrossChuHanRecruitSoldierReqMsg.parseFrom(packet.getBytes());
        CrossChuHanActivity activity = CrossChuHanMgr.getActivity(reqMsg.getActivityId(), groupId);
        activity.setLastReqTime(packet.getPlayerId());
        if (reqMsg.getReqType() == 1) {
            activity.recruitSoldier(serverId, packet.getPlayerId(), reqMsg);
        } else {
            activity.recruitSoldierSliver(serverId, packet.getPlayerId(), reqMsg);
        }
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData() {

    }
}
